package com.huangkailong.designpattern.prototype;

import java.util.List;
import lombok.Data;

/**
 * 浅拷贝原型模式实现.
 *
 * @author huangkl
 * @since 1.0.0
 */
@Data
public class ShallowClonePrototype implements Cloneable {
    private String userName;
    private String password;
    private List<String> hobbies;

    @Override
    protected ShallowClonePrototype clone() {
        try {
            return (ShallowClonePrototype) super.clone();
        } catch (CloneNotSupportedException e) {
            e.printStackTrace();
            throw new RuntimeException(e.getMessage(), e);
        }
    }
}
